<?php


require_once(dirname(__FILE__).'/../../common/log.php');
require_once(dirname(__FILE__).'/../../common/defines.php');
require_once(dirname(__FILE__).'/../../common/return.php');

require_once(dirname(__FILE__).'/aliyun/send_sms.php');


$body  = file_get_contents('php://input');
$data  = json_decode($body, true);
logd("recv: ".$body);
if ((!isset($data['phone'])) || empty($data['smsCode']))
{
    failure(ERR_PARAM);
}

$ret  = send_authcode_sms($data['phone'], $data['smsCode']);

if ($ret->Code == 'OK')
{
    success();
}
else
{
    failure(-10, $ret->Message);
}

